<?
if (!defined('SMF'))
	die('Hacking attempt...');

function BlackNova()
{
	global $smcFunc, $boarddir, $context, $settings;
	
	$context['blacknova'] = array();
	
	if (isset($_REQUEST['xml']))
	{
		// Load the BlackNova language file.
		loadLanguage('BlackNova');
		
		//Load standard empty template for ajax calls
		$context['sub_template'] = 'bnt_ajax';
		
		$action = $_GET['sa'];
		require_once($boarddir . '/bnt/' . $action . '.php');
		
		return;
	}
	
	// Load the BlackNova language file.
	loadLanguage('BlackNova');
	
	// Load the BlackNova template.
	loadTemplate('BlackNova');
	
	// Use the BlackNova layer.
	$context['template_layers'][] = 'blacknova';
	
	// Add the BlackNova stylesheets and scripts.
	$context['html_headers'] .= '
		<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/BlackNova.css" />
		<link type="text/css" href="' . $settings['default_theme_url'] . '/css/bnt-theme/jquery-ui-1.7.2.custom.css" rel="Stylesheet" />
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jquery-1.3.2.js"></script>
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jquery-ui-1.7.2.custom.js"></script>
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jquery.corners.js"></script>
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jquery.field.js"></script>
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jquery.tablesorter.js"></script>
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jquery.gradient.min.js"></script>
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jquery.dimensions.min.js"></script>
		<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/BlackNova.js"></script>';
	
	// Some actions we can do.
	$actions = array(
		'attack' => "Attack",
		'beacon' => "Beacon",
		'bounty' => "Bounty",
		'corp' => "Corp",
		'createplayer' => "CreatePlayer",
		'createplayer2' => "CreatePlayer2",
		'defence_report' => "DefenceReport",
		'device' => "Device",
		'dump' => "Dump",
		'emerwarp' => "Emerwarp",
		'igb' => "IGB",
		'faq' => "FAQ",
		'galaxy' => "Galaxy",
		'genesis' => "Genesis",
		'help' => "Help",
		'log' => "GameLog",
		'login' => "Login",
		'lrscan' => "LRScan",
		'mailto' => "Mailto",
		'mailto2' => "Mailto2",
		'main' => "Main",
		'mines' => "Mines",
		'modify_defences' => "ModifyDefences",
		'move' => "Move",
		'navcomp' => "Navcomp",
		'new' => "New",
		'newplayer' => "NewPlayer",
		'news' => "News",
		'news_test' => "NewsTest",
		'options' => "Options",
		'options2' => "Options2",
		'planet' => "Planet",
		'planet_report' => "PlanetReport",
		'planet_report_ce' => "PlanetReportCE",
		'port' => "Port",
		'port2' => "Port2",
		'ranking' => "Ranking",
		'readmail' => "ReadMail",
		'report' => "Report",
		'rsmove' => "RSMove",
		'scan' => "Scan",
		'self_destruct' => "SelfDestruct",
		'settings' => "Settings",
		'ship' => "Ship",
		'teams' => "Teams",
		'team_planets' => "TeamPlanets",
		'traderoute' => "Traderoute",
		'warpedit' => "WarpEdit",
		'warpedit2' => "WarpEdit2",
		'warpedit3' => "WarpEdit3",
		'zoneedit' => "ZoneEdit",
		'zoneinfo' => "ZoneInfo"
	);
	
	// Look for a subaction.
	$action = (isset($_GET['sa'])) ? $_GET['sa'] : 'login';
	
	// Make sure it is a valid subaction, otherwise go to the index.
	if (isset($actions[$action]))
		$actions[$action]();
	else
		Login();
}

function Attack()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Attack page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=attack',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_attack'];
}

function Beacon()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Beacon page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=beacon',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_beacon'];
}

function Bounty()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Bounty page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=bounty',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_bounty'];
}

function Corp()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Corperate Planet page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=corp',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_corp'];
}

function CreatePlayer()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Createplayer page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=createplayer',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_createplayer'];
}

function CreatePlayer2()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Createplayer2 page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=createplayer2',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_createplayer'];
}

function DefenceReport()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Defence Report page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=defence_report',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_defrep'];
}

function Device()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Device page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=device',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_device'];
}

function Dump()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Dump page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=dump',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_dump'];
}

function Emerwarp()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT EWD page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=emerwarp',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_emerwarp'];
}

function FAQ()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT FAQ page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=faq',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_faq'];
}

function Galaxy()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Galaxy Map page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=galaxy',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_galaxy'];
}

function GameLog()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Log page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=log',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_log'];
}

function Genesis()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Genesis page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=genesis',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_genesis'];
}

function Help()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Help page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=help',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_genesis'];
}

function IGB()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT IGB page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=igb',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_igb'];
}

function Login()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Login page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=login',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'index';
	$context['page_title'] = $txt['bnt_title_login'];
}

function Login2()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Login2 page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=login2',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_login2'];
}

function Logout()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Logout page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=logout',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_logout'];
}

function LRScan()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT LRScan page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=lrscan',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_lrscan'];
}

function MailTo()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Mail To page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=mailto',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_mailto'];
}

function MailTo2()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Mail 2 To page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=mailto2',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_mailto2'];
}

function Main()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Main page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=main',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_main'];
}

function ModifyDefences()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Modify Defences page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=modify_defences',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_modifydefences'];
}

function Mines()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Mines/Fighters page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=mines',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_mines'];
}

function Move()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Move page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=move',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_move'];
}

function Navcomp()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Nav Computer page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=navcomp',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_navcomp'];
}

function NewPlayer()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Login page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=newplayer',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_newplayer'];
}

function News()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Login page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=news',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_news'];
}

function Options()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Options page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=options',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_options'];
}

function Options2()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Options2 page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=options2',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_options2'];
}

function Planet()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Planet page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=planet',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_planet'];
}

function PlanetReport()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Planet Report page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=planet_report',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_planetreport'];
}

function PlanetReportCE()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Planet Report CE page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=planet_report_ce',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_planetreportce'];
}

function Port()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Port page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=port',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_port'];
}

function Port2()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Port 2page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=port2',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_port2'];
}

function Preset()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Preset page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=preset',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_preset'];
}

function Ranking()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Ranking page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=ranking',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_ranking'];
}

function ReadMail()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Read Mail page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=readmail',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_readmail'];
}

function Report()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Ship Report page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=report',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_report'];
}

function RSMove()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT real space move page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=rsmove',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_rsmove'];
}

function Scan()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Scan page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=scan',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_scan'];
}

function Scheduler()
{
	global $boarddir;
	
	// Load the BlackNova language file.
	loadLanguage('BlackNova');
	
	require_once($boarddir . '/bnt/scheduler.php');
}

function Ship()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Ship page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=ship',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_ship'];
}

function SelfDestruct()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Ship page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=self_destruct',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_selfdestruct'];
}

function Settings()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Ranking page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=settings',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_settings'];
}

function Teams()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Teams page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=teams',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_teams'];
}

function TeamPlanets()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Team Planets page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=team_planets',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_teamplanets'];
}

function Traderoute()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Ranking page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=traderoute',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_traderoute'];
}

function WarpEdit()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Warp Edit page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=warpedit',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_warpedit'];
}

function WarpEdit2()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Warp Edit 2 page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=warpedit2',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_warpedit2'];
}

function WarpEdit3()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Warp Edit 3 page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=warpedit3',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_warpedit3'];
}

function ZoneEdit()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Zone Edit page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=zoneedit',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_zoneedit'];
}

function ZoneInfo()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Zone Info page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=zoneinfo',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
	$context['page_title'] = $txt['bnt_title_zoneinfo'];
}

function NewsTest()
{
	global $context, $scripturl, $txt;
	
	// Add the BNT Zone Info page to the link tree
	$context['linktree'][] = array(
		'url' => $scripturl . '?action=blacknova;sa=news_test',
		'name' => 'BlackNova',
	);
	
	$context['sub_template'] = 'main';
}

?>